home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / DINKDEMO / DINKCLAS / DEVENTHA.C < prev    next >
Text File  |  1992-07-08  |  2KB  |  125 lines

  1. /*
  2.     File:        DEventHandler.c
  3.  
  4.     Written by:    Mark Gross
  5.  
  6.     Copyright:    ⌐ 1992 by Applied Technical Software, all rights reserved.
  7.     Use at your own risk.
  8.  
  9. */
  10. #include "DEventHandler.h"
  11. #include "DApplication.h"
  12.  
  13. DApplication*    DEventHandler::gApplication = NULL;
  14. Boolean        DEventHandler::gPassItOn = TRUE;
  15.  
  16. DEventHandler::DEventHandler(void)
  17. {
  18.     fNextHandler = NULL;
  19.     fAlive = TRUE;
  20.     if(gApplication)
  21.         gApplication->InstalHandler(this);
  22. }
  23.  
  24. DEventHandler::~DEventHandler(void)
  25. {
  26.  
  27. }
  28.  
  29.     
  30. void DEventHandler::KillMeNext(void)
  31. {
  32.     gApplication->RemoveHandler( this);
  33.     fAlive = FALSE;     
  34. }
  35.  
  36.  
  37.  
  38. void DEventHandler:: HandleNullEvent(EventRecord *theEvent)
  39. {
  40.     if (gPassItOn && fNextHandler)
  41.         fNextHandler->HandleNullEvent(theEvent);
  42. }
  43.  
  44.  
  45. void DEventHandler:: HandleActivateEvt(EventRecord *theEvent)
  46. {
  47.     if (gPassItOn && fNextHandler)
  48.         fNextHandler->HandleActivateEvt(theEvent);
  49. }
  50.  
  51.  
  52. void DEventHandler:: HandleAutoKey(EventRecord *theEvent)
  53. {
  54.     if (gPassItOn && fNextHandler)
  55.         fNextHandler->HandleAutoKey(theEvent);
  56. }
  57.  
  58.  
  59. void DEventHandler:: HandleKeyDown(EventRecord *theEvent)                
  60. {
  61.     if (gPassItOn && fNextHandler)
  62.         fNextHandler->HandleKeyDown(theEvent);
  63. }
  64.  
  65.  
  66. void DEventHandler:: HandleDiskEvt(EventRecord *theEvent)
  67. {
  68.     if (gPassItOn && fNextHandler)
  69.         fNextHandler->HandleDiskEvt(theEvent);
  70. }
  71.  
  72.  
  73. void DEventHandler:: HandleHighLevelEvent(EventRecord *theEvent)
  74. {
  75.     if (gPassItOn && fNextHandler)
  76.         fNextHandler->HandleHighLevelEvent(theEvent);
  77. }
  78.  
  79.  
  80. void DEventHandler:: HandleOSEvent(EventRecord *theEvent)
  81. {
  82.  
  83.     if (gPassItOn && fNextHandler)
  84.         fNextHandler->HandleOSEvent(theEvent);
  85. }
  86.  
  87.  
  88.  
  89. void DEventHandler:: HandleUpdateEvt(EventRecord *theEvent)
  90. {
  91.  
  92.     if (gPassItOn && fNextHandler)
  93.         fNextHandler->HandleUpdateEvt(theEvent);
  94. }
  95.     
  96.  
  97. void DEventHandler::HandleMouseDown(EventRecord *theEvent, short thePart, WindowPtr theWindow)
  98. {
  99.     if (gPassItOn && fNextHandler)
  100.         fNextHandler->HandleMouseDown(theEvent, thePart, theWindow);
  101. }
  102.  
  103. void DEventHandler::HandleMenuChoice(short menuID, short menuItem)
  104. {
  105.     if (gPassItOn && fNextHandler)
  106.         fNextHandler->HandleMenuChoice(menuID, menuItem);
  107. }
  108.  
  109.  
  110. void    DEventHandler::EnableMenuItem(MenuHandle menu, short item, Boolean enable)
  111. {
  112.  
  113.     if (enable) 
  114.         EnableItem(menu, item);
  115.     else
  116.         DisableItem(menu, item);
  117.     
  118. }// 
  119.     
  120. void DEventHandler::SetUpMenues(void)
  121. {
  122.     if (gPassItOn && fNextHandler)
  123.         fNextHandler->SetUpMenues();
  124. }
  125.